require('../../assets/css/index.js')
require('../../assets/fonts/font/iconfont.css')
require('../../assets/lib/swiper/swiper-bundle.css')
let Swiper = require('../../assets/lib/swiper/swiper-bundle.js')
require('../../utils/local.js')
let https = require('../../utils/https.js')
// 引入公共js
let dom = require('../../utils/dom.js')
const local = require('../../utils/local.js')
//引入当前页面的less文件
require('./video.less')
// 当前页面js
dom.isLogin()
// 引入echarts

dom.ready(function(){
    // 获取本地数据
    let localData=local.get('fragments');
    console.log(localData);
    //动态办法第一条数据默认
    let firstData=localData[0].videoUrl;
    dom.getEle("video").src=https.hostUrl+firstData;
    // 全局标杆
    let flag=true;
    let index=0;
    // 播放暂停
    dom.getEle("#palyBtn").addEventListener("click",function(){
        if(flag){
            dom.getEle("video").play();
           
        }else{
            dom.getEle("video").pause();

        }
        flag=!flag;
    })
    // 下一页
    dom.getEle("#nextBtn").addEventListener("click",function(){
        index++;
        if(index==4){
            index==0;
    
        }
    dom.getEle("video").src=https.hostUrl+localData[index].videoUrl;
    console.log(https.hostUrl+localData[index].videoUrl);

    })
    dom.getEle("#prevBtn").addEventListener("click",function(){
        window.history.go(-1)
    })
    
})